1 using UnityEngine;
2 using
System.Collections;
3
4 public
class Gold : MonoBehaviour {
5
6     
private Vector3 speedLeft = new Vector3(-2, 0, 0);
7     
private bool isRunning;
8
9     
public void Start()
10     {
11         isRunning =
true;
12     }
13
14     
void Update()
15     {
16         
if(isRunning)
17             gameObject.transform.localPosition += speedLeft * Time.deltaTime;
18     }
19
20     
public void setRunning(bool isRunning)
21     {
22         
this.isRunning = isRunning;
23     }
24     
25 }



Trò chơi đua xe động vật trong UNITY Engine 114.617 lượt xem

Gõ tìm kiếm nhanh...